<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCouponsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupons', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('code')->default('')->comment('优惠码');
            $table->string('name')->default('')->comment('名称');
            $table->text('description')->nullable()->comment('描述');
            $table->decimal('reached_amount')->default('0')->comment('满足金额');
            $table->decimal('discount')->default('0')->comment('优惠额');
            $table->integer('use_num')->default('0')->nullable()->comment('使用次数');
            $table->integer('status')->default('0')->comment('状态');
            $table->integer('creator_id')->default('0')->comment('创建者');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupons');
    }
}
